<template>
  <div class="page">
    <div class="switch-box">
      <div class="left-text">车辆/卡票号不在场可以领券</div>
      <div class="switch-wrap" @click="openOrClose()">
        <span class="btn" :class="isEnable ? 'btn_on' : 'btn_off'"><!--btn_on 进行中样式  btn_off 已暂停样式-->  
            <i class="t_green">启用</i>
            <i class="t_grey">禁用</i>  
            <i class="btn_bg"></i>  
        </span>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      title: "配置管理",
      isEnable: false, //按钮是否开启
    };
  },
  created() {
    this.$store.commit("setTitle", this.title);
    this.$store.commit("setShowCloseBtn", false);
  },
  methods: {
    openOrClose(){
      this.isEnable = this.isEnable ? false : true;
    }
  }
};
</script>

<style scoped>
.switch-box {
  height: 100px;
  /* border: 1px solid red; */
  margin-top: 20px;
  display: flex;
  justify-content: space-between;
  line-height: 100px;
  padding: 0 20px;
  background: #ffffff;
}
.left-text {
  font-size: 30px;
  color: #262626;
  letter-spacing: 0;
}
.switch-wrap{
  height: 100px;
  line-height: 100px;
  display: flex;
  align-items:center;
}
.switch-wrap i {
  font-style: normal;
}
/*暂停/启用 按钮*/
.switch-wrap .btn {
  display: block;
  width: 138px;
  height: 62px;
  border: 2px solid #e5e5e5;
  border-radius: 50px;
  cursor: pointer;
  position: relative;
  background-color: #ffffff;
}
/*暂停/启用  文字*/
.btn .t_green,
.btn .t_grey {
  display: block;
  width: 50%;
  height: 62px;
  line-height: 62px;
  font-size: 24px;
  color: #707070;
  opacity: 0;
}
.btn .t_green {
  float: left;
}
.btn .t_grey {
  float: right;
}
/*暂停/启用  是否启用状态圆圈*/
.btn_bg {
  display: block;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  position: absolute;
  top: 0px;
  -webkit-transition: all 0.2s linear;
  -moz-transition: all 0.2s linear;
  -ms-transition: all 0.2s linear;
  -o-transition: all 0.2s linear;
  transition: all 0.2s linear;
  background-color: #ffffff;
  border: 1px solid #e5e5e5;
  box-shadow: 2px 2px 5px #c6c6c6;
}
/*不同状态下的相应样式*/
.switch-wrap .btn_on{ /*启动*/
  background-color: #38d39f;
}
/*暂停/启用  文字*/
.btn_on .t_green { /*启用*/
  color: #ffffff;
  opacity: 1;
  text-align: right;
}
.btn_off .t_grey { /*禁用*/
  opacity: 1;
  text-align: center;
}
/*暂停/启用  是否启用状态圆圈*/
.btn_on .btn_bg {
  left: 78px;
}
.btn_off .btn_bg {
  left: 0px;
}
</style>

